package reversi;



public class PontuacaoDaTabela extends Estrategia {


	public PontuacaoDaTabela(double pesoComeco, double pesoMeio,
			double pesoFim, double escala) {
		super(pesoComeco, pesoMeio, pesoFim, escala);
	}

	public static int[][] TABELADESCORE =
	{{100,-20 ,10,5,5,10,-20,100},
	 {-20,-50,-2,-2,-2,-2,-50,-20},
	 {10,-2,-1,-1,-1,-1,-2,10},
	 {5,-2,-1,-1,-1,-1,-2,5},
	 {5,-2,-1,-1,-1,-1,-2,5},
	 {10,-2,-1,-1,-1,-1,-2,10},
	 {-20,-50,-2,-2,-2,-2,-50,-20},
	 {100,-20 ,10,5,5,10,-20,100}
	};
	
	@Override
	public int avaliaEstado(GameState estado, int indiceJogador, Move movimento) {
		int avaliacao = 0;
		for(int i = 0; i<estado.getWidth(); i++)
			for(int j = (int) 0; j<estado.getHeight(); j++){
				if(estado.getMarkAt(i, j)==indiceJogador){
					avaliacao+= TABELADESCORE[i][j];
				}
				if(estado.getMarkAt(i, j)==getIndiceAdversario(indiceJogador)){
					avaliacao-= TABELADESCORE[i][j];
				}
			}
				
		return avaliacao;
	}

	public String toString(){
		return "Pont: "+this.getPesoComeco()+" "+this.getPesoMeio()+" "+this.getPesoFim()+"\n";
	}

}
